// antd 按需加载
import { Toast, Portal } from '@ant-design/react-native';

import store from '../../../store/store.js'
import * as ActionTypes from '../../../constants/constants.js'
import { isUser, isWxUser, path, saveData, loadData, removeData } from '../../../util/utils.js'
import request from '../../../api/request.js'

export async function list(options) {
    const { dispatch } = this.props
    const res = await request.BehalfController.productList(options)
    Portal.remove()
    if (res.error) {
        dispatch({
            type: ActionTypes.magazineError,
            data: res
        })
        return
    }
    dispatch({
        type: ActionTypes.magazine,
        data: res.data.data
    })
}



// export async function list(options) {
//     const { dispatch } = this.props
//     const { refresh } = options
//     const loading = Toast.loading('加载中', 0, null, false)
//     const res = await request.GoodsController.list(options)
    
//     if (res.error) {
//         dispatch({
//             type: ActionTypes.magazineError,
//             data: res
//         })
//         return
//     }
//     if (refresh) {
//         dispatch({
//             type: ActionTypes.magazineRefresh,
//             data: res.data.data
//         })
//     } else {
//         dispatch({
//             type: ActionTypes.magazine,
//             data: res.data.data
//         })
//     }
// }

